/** 
 *  @file
 *  @brief   平面4节点四边形形函数
 *  @author  wanghuan
 *  @date    2024.03.09
 *  @version v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include <cassert>
#include <vector>
#include "Utility/Algebra/Matrix.h"
#include "DataStructure/Common/SGNamespace.h"
#include "DataStructure/Input/Solver/IntegPoint.h"
#include "../Common/IntegrationExport.h"

SG_NAMESPACE_OPEN
namespace FEMSolver {
namespace Element {

/** @brief 四节点四边形形函数。
 * 
 * 传入积分格式，返回积分点处形函数及形函数对参数坐标导数
 */
class Integration_DECLSPEC Plane4NodeShpFunc
{
public:
    Plane4NodeShpFunc ();
    void Compute (const SG::DataStructure::FEM::IntegPointArray& integPoints);
    const SG::Algebra::Matrixd& GetShapeFunction (std::size_t index) const;
    const SG::Algebra::Matrixd& GetShapeFunctionDerivative (std::size_t index) const;

private:
    std::vector<SG::Algebra::Matrixd> NSet;
    std::vector<SG::Algebra::Matrixd> DNDxiSet;
};

inline const SG::Algebra::Matrixd& Plane4NodeShpFunc::GetShapeFunction (std::size_t index) const
{
    assert (index < NSet.size ());
    return NSet[index];
}

inline const SG::Algebra::Matrixd& Plane4NodeShpFunc::GetShapeFunctionDerivative (std::size_t index) const
{
    assert (index < DNDxiSet.size ());
    return DNDxiSet[index];
}

}; // end namaspace FEMSolver
}; // end namespace Element
SG_NAMESPACE_CLOSE